package com.xiaotu.spider.task.pipeline;

import org.springframework.stereotype.Component;

import com.xiaotu.common.model.CheckMovieInfoModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.spider.APipeline;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;


@Component("CheckMaoYanMovieDataIdUpdatePipeline")
public class CheckMaoYanMovieDataIdUpdatePipeline extends APipeline{

	@Override
	protected void doProcess(ResultItems resultItems, Task task) {
		
		CheckMovieInfoModel obj = resultItems.get(CheckMovieInfoModel.class.getName());
		if(null != obj){
			String key = DataRedisKeyUtils
					.getKey(Constants.DataRedisKey.MAOYAN_MOVIE_DATAID_CHECK_YYYYMMDD);
			cacheHandler.hSet(key,obj.getId()+"_"+obj.getDataId(),obj);
			cacheHandler.setCacheTimeout(key);
		}
		
	}
	
}
